package com.horoscope.astrology.zodiac.signs.free.utils

import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.RecyclerView

/**
 *  作者    1024
 *  时间    2019-11-21 18:54
 *  文件    constellation-android
 *  描述    Recyclerview下边距
 */
class ItemDecorationToBottom(space: Int) : RecyclerView.ItemDecoration() {

    private var marginWidth = SysUtils.rp(space.toFloat())

    override fun getItemOffsets(
        outRect: Rect,
        view: View,
        parent: RecyclerView,
        state: RecyclerView.State
    ) {
        super.getItemOffsets(outRect, view, parent, state)
        outRect.left = marginWidth
        outRect.right = marginWidth

        if (parent.getChildAdapterPosition(view) == 0)
            outRect.top = 0
    }

}